

<template>
  <div class="exponent">
    <div class="table">
      <p class="title">
        <span class="vertical"></span>
        <span class="text">相同指数统计</span>
        <span class="base">Bet365</span>
      </p>
      <a-table :columns="columns" :pagination="false" :data-source="data"></a-table>
    </div>


    <div class="tab-container">
      <div
          v-for="(tab, index) in tabs"
          :key="index"
          class="tab"
          :class="{ active: activeTab === index }"
          @click="setActiveTab(index)"
      >
        <span>{{ tab }}</span>
        <div v-if="activeTab === index" class="underline">
        </div>
      </div>
    </div>

    <div class="fairText">
      <div class="text">
        <p>让球上升0家</p>
        <p>持平11家</p>
        <p>让球下降21家</p>
      </div>

      <div class="confrontation">
        <div class="left"></div>
        <div class="right"></div>
      </div>

      <div class="tableBase table">
        <a-table :columns="columnsBase" :pagination="false" :data-source="dataBase">
          <template #name="{ text }">
            <a>{{ text }}</a>
          </template>
        </a-table>
      </div>

    </div>
  </div>

</template>


<script setup lang="ts">
import {ref} from "vue";

const columns = [

  {
    title: '指数',
    dataIndex: 'name',
    key: 'name',
  },
  {
    title: '初始指数',
    dataIndex: 'age',
    key: 'age',
    ellipsis: true,
    width: 100,

  },
  {
    title: '赛果',
    dataIndex: 'address',
    key: 'address',
    ellipsis: true,
  },
  {
    title: '概率',
    dataIndex: 'tags',
    key: 'tags',
    ellipsis: true,
    width: 80,
    render: () => {
      return {
        style: {'color': 'red'}
      }
    }
  }
];

const data = [
  {
    key: '1',
    name: '让球',
    age: '1.00 0/0.5 0.90',
    address: '14赢0走33输',
    tags: '30.0%赢'
  },
  {
    key: '1',
    name: '胜平负',
    age: '1.00 0/0.5 0.90',
    address: '14赢0走33输',
    tags: '20.0%胜'
  },

];
const activeTab = ref(0)
const tabs: any = ref([
  '让球','胜平负','总进球', '角球'
])

const setActiveTab = (index: number) => {
  activeTab.value = index
}


const renderContent = ({ text, index }: any) => {
  const obj = {
    children: text,
    props: {} as any,
  };
  if (index === 4) {
    obj.props.colSpan = 0;
  }
  return obj;
};
const columnsBase = [
  {
    title: '公司(32家)',
    width: 100,
    dataIndex: 'name',
    customRender: ({ text, index }) => {
      const obj = {
        children: text,
        props: {} as any,
      };
      if (index === 0) {
        obj.props.rowSpan = 2;
      } else {
        obj.props.rowSpan = 0;
      }
      return obj;
    },
  },
  {
    title: '',
    dataIndex: 'age',
  },
  {
    title: '主',
    dataIndex: 'tel',
  },
  {
    title: '让',
    dataIndex: 'phone',
  },
  {
    title: '客',
    dataIndex: 'address',
  },
];
const dataBase = [
  {
    key: '1',
    name: 'Bet365',
    age: '初',
    tel: '1.00',
    phone: '受平/半',
    address: '0.90',
  },  {
    key: '2',
    name: 'Bet365',
    age: '即',
    tel: '1.00',
    phone: '受平/半',
    address: '0.90',
  }
];

</script>

<style scoped lang="scss">

.exponent {
  padding: 0 16px;
  .table {
    //#F6F8FF
    :deep(.ant-table-thead th) {
      background-color: #F6F8FF;
      font-family: PingFang SC, PingFang SC;
      font-weight: 400;
      font-size: 12px!important;
      color: #AFB8CB;
    }
    :deep(.ant-table-tbody td) {
      font-family: PingFang SC, PingFang SC;
      font-weight: 400;
      font-size: 12px!important;
      color: #525A79;
      background-color: #fff;
    }

    .title {
      margin-bottom: 20px;
      display: flex;
      align-items: center;
      font-weight: 400;
      font-size: 14px;
      color: #525A79;
      .vertical {
        width: 2px;
        height: 20px;
        background: #16B13A;
        border-radius: 2px;
      }
      .text {
        margin:0 6px;
      }
      .base {
        font-weight: 500;
        font-size: 12px;
        color: #AFB8CB;
      }
    }

  }



  .tab-container {
    display: flex;
    margin-top: 20px;
    justify-content: space-around;
    align-items: center;
    height: 30px;
    background: #F6F8FF;
    border-radius: 20px 20px 20px 20px;
  }
  .tab {
    position: relative;
    padding: 5px 20px;
    font-size: 14px;
    cursor: pointer;
    color: rgba(175, 184, 203, 1);
    text-align: center;
    p {
      line-height: 1.5;
    }
  }

  .tab.active {
    color: rgb(255, 255, 255);
    font-weight: bold;
    height: 28px;
    background: #16B13A;
    border-radius: 20px 20px 20px 20px;
  }

  .fairText {
    border-top: 1px solid #E2EEFF;
    padding-top: 20px;
    margin-top: 20px;
    .text {
      display: flex;
      align-items: center;
      justify-content: space-between;
      p {
        font-family: PingFang SC, PingFang SC;
        font-weight: 400;
        font-size: 12px;
        color: #525A79;
      }
    }
    .confrontation {
      position: relative;
      height: 8px;
      margin-top: 10px;
      background: #D9D9D9;
      border-radius: 8px;
      .right {
        position: absolute;
        content: '';
        background-color: #16B13A;
        border-radius: 8px;
        height: 8px;
        width: 50%;
        right: 0;
        top: 0;
      }
      .left {
        position: absolute;
        content: '';
        background-color: #E95D5D;
        border-radius: 8px;
        height: 8px;
        width: 32px;
        left: 0;
        top: 0;
      }
    }

  }

  .tableBase {
    margin-top: 24px;

    :deep(.ant-table-tbody td) {
      background-color: #F6F8FF;
      font-size: 12px;
    }
  }

}

</style>
